const mysql = require('mysql2/promise');
require('dotenv').config({ path: './backend/.env' });

const dbConfig = {
  host: process.env.DB_HOST,
  port: process.env.DB_PORT,
  user: process.env.DB_USER,
  password: process.env.DB_PASSWORD,
  database: process.env.DB_NAME,
  charset: 'utf8mb4',
  timezone: '+08:00'
};

async function checkTableStructure() {
  try {
    const connection = await mysql.createConnection(dbConfig);
    console.log('✅ 数据库连接成功');
    
    // 检查 cloud_files 表结构
    const [rows] = await connection.execute('DESCRIBE cloud_files');
    console.log('\n📋 cloud_files 表结构:');
    console.table(rows);
    
    // 检查 storage_quotas 表结构
    const [quotaRows] = await connection.execute('DESCRIBE storage_quotas');
    console.log('\n📋 storage_quotas 表结构:');
    console.table(quotaRows);
    
    await connection.end();
  } catch (error) {
    console.error('❌ 数据库操作失败:', error.message);
  }
}

checkTableStructure();
